1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
#![allow(non_camel_case_types, non_snake_case)]
use crate::co;
use crate::decl::*;
use crate::kernel::ffi_types::*;
use crate::ole::privs::*;
use crate::prelude::*;
use crate::vt::*;
/// [`ITaskbarList3`](crate::ITaskbarList3) virtual table.
#[repr(C)]
pub struct ITaskbarList3VT {
pub ITaskbarList2VT: ITaskbarList2VT,
pub SetProgressValue: fn(COMPTR, HANDLE, u64, u64) -> HRES,
pub SetProgressState: fn(COMPTR, HANDLE, u32) -> HRES,
pub RegisterTab: fn(COMPTR, HANDLE, HANDLE) -> HRES,
pub UnregisterTab: fn(COMPTR, HANDLE) -> HRES,
pub SetTabOrder: fn(COMPTR, HANDLE, HANDLE) -> HRES,
pub SetTabActive: fn(COMPTR, HANDLE, HANDLE, u32) -> HRES,
pub ThumbBarAddButtons: fn(COMPTR, HANDLE, u32, PVOID) -> HRES,
pub ThumbBarUpdateButtons: fn(COMPTR, HANDLE, u32, PVOID) -> HRES,
pub ThumbBarSetImageList: fn(COMPTR, HANDLE, HANDLE) -> HRES,
pub SetOverlayIcon: fn(COMPTR, HANDLE, HANDLE, PCSTR) -> HRES,
pub SetThumbnailTooltip: fn(COMPTR, HANDLE, PCSTR) -> HRES,
pub SetThumbnailClip: fn(COMPTR, HANDLE, PVOID) -> HRES,
}
com_interface! { ITaskbarList3: "ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf";
/// [`ITaskbarList3`](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-itaskbarlist3)
/// COM interface over [`ITaskbarList3VT`](crate::vt::ITaskbarList3VT).
///
/// Automatically calls
/// [`IUnknown::Release`](https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-release)
/// when the object goes out of scope.
///
/// # Examples
///
/// ```no_run
/// use winsafe::{self as w, prelude::*, co};
///
/// let obj = w::CoCreateInstance::<w::ITaskbarList3>(
/// &co::CLSID::TaskbarList,
/// None,
/// co::CLSCTX::INPROC_SERVER,
/// )?;
/// # w::HrResult::Ok(())
/// ```
}
impl shell_ITaskbarList for ITaskbarList3 {}
impl shell_ITaskbarList2 for ITaskbarList3 {}
impl shell_ITaskbarList3 for ITaskbarList3 {}
/// This trait is enabled with the `shell` feature, and provides methods for
/// [`ITaskbarList3`](crate::ITaskbarList3).
///
/// Prefer importing this trait through the prelude:
///
/// ```no_run
/// use winsafe::prelude::*;
/// ```
pub trait shell_ITaskbarList3: shell_ITaskbarList2 {
/// [`ITaskbarList3::RegisterTab`](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-registertab)
/// method.
fn RegisterTab(&self, hwnd_tab: &HWND, hwnd_mdi: &HWND) -> HrResult<()> {
ok_to_hrresult(
unsafe {
(vt::<ITaskbarList3VT>(self).RegisterTab)(
self.ptr(),
hwnd_tab.ptr(),
hwnd_mdi.ptr(),
)
},
)
}
/// [`ITaskbarList3::SetOverlayIcon`](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setoverlayicon)
/// method.
fn SetOverlayIcon(&self,
hwnd: &HWND,
hicon: Option<&HICON>,
description: &str,
) -> HrResult<()>
{
ok_to_hrresult(
unsafe {
(vt::<ITaskbarList3VT>(self).SetOverlayIcon)(
self.ptr(),
hwnd.ptr(),
hicon.map_or(std::ptr::null_mut(), |h| h.ptr()),
WString::from_str(description).as_ptr(),
)
},
)
}
/// [`ITaskbarList3::SetProgressState`](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setprogressstate)
/// method.
fn SetProgressState(&self,
hwnd: &HWND,
tbpf_flags: co::TBPF,
) -> HrResult<()>
{
ok_to_hrresult(
unsafe {
(vt::<ITaskbarList3VT>(self).SetProgressState)(
self.ptr(),
hwnd.ptr(),
tbpf_flags.raw(),
)
},
)
}
/// [`ITaskbarList3::SetProgressValue`](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setprogressvalue)
/// method.
///
/// # Examples
///
/// Setting progress to 50%:
///
/// ```no_run
/// use winsafe::{self as w, prelude::*};
///
/// let tbar: w::ITaskbarList3; // initialized somewhere
/// # let tbar = unsafe { w::ITaskbarList3::null() };
/// let hwnd: w::HWND;
/// # let hwnd = w::HWND::NULL;
///
/// tbar.SetProgressValue(&hwnd, 50, 100)?;
/// # w::HrResult::Ok(())
/// ```
fn SetProgressValue(&self,
hwnd: &HWND,
completed: u64,
total: u64,
) -> HrResult<()>
{
ok_to_hrresult(
unsafe {
(vt::<ITaskbarList3VT>(self).SetProgressValue)(
self.ptr(),
hwnd.ptr(),
completed,
total,
)
},
)
}
/// [`ITaskbarList3::SetTabActive`](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-settabactive)
/// method.
fn SetTabActive(&self, hwnd_tab: &HWND, hwnd_mdi: &HWND) -> HrResult<()> {
ok_to_hrresult(
unsafe {
(vt::<ITaskbarList3VT>(self).SetTabActive)(
self.ptr(),
hwnd_tab.ptr(),
hwnd_mdi.ptr(),
0,
)
},
)
}
/// [`ITaskbarList3::SetTabOrder`](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-settaborder)
/// method.
fn SetTabOrder(&self,
hwnd_tab: &HWND,
hwnd_insert_before: &HWND,
) -> HrResult<()>
{
ok_to_hrresult(
unsafe {
(vt::<ITaskbarList3VT>(self).SetTabOrder)(
self.ptr(),
hwnd_tab.ptr(),
hwnd_insert_before.ptr(),
)
},
)
}
/// [`ITaskbarList3::SetThumbnailClip`](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setthumbnailclip)
/// method.
fn SetThumbnailClip(&self, hwnd: &HWND, clip: Option<RECT>) -> HrResult<()> {
ok_to_hrresult(
unsafe {
(vt::<ITaskbarList3VT>(self).SetThumbnailClip)(
self.ptr(),
hwnd.ptr(),
&clip as *const _ as _,
)
},
)
}
/// [`ITaskbarList3::SetThumbnailTooltip`](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setthumbnailtooltip)
/// method.
fn SetThumbnailTooltip(&self,
hwnd: &HWND,
tip: Option<&str>,
) -> HrResult<()>
{
ok_to_hrresult(
unsafe {
(vt::<ITaskbarList3VT>(self).SetThumbnailTooltip)(
self.ptr(),
hwnd.ptr(),
tip.map_or(std::ptr::null_mut(), |s| WString::from_str(s).as_ptr()),
)
},
)
}
}